import { localStoragePrefix } from '@/config'
import { defaultLocale} from "@/config";

// 获取默认语言
export const getDefaultLocale = () => {

  // 获取浏览器语言
  const navigatorLanguage = (navigator.language || navigator.browserLanguage).toLowerCase() === 'zh-cn' ? defaultLocale : 'en'

  // 获取存到本地的语言
  const localStorageLanguage = localStorage.getItem(localStoragePrefix) || null

  if(localStorageLanguage) return localStorageLanguage

  return navigatorLanguage

}
